<script setup lang="ts">
import { ref } from 'vue';
import {reqLogin} from "@/apis/login";

const form = ref<IForm>({
    username: '',
    password: ''
})

const onSubmit = () => {
    reqLogin(form.value).then(() => {
        console.log('登录成功')
    }).catch(e => {
        console.error(e)
        console.log('登录失败')
    })
}
</script>

<template>
<div>
    <el-form :model="form">
        <el-form-item label="用户名" prop="username">
            <el-input v-model="form.username" placeholder="用户名" />
        </el-form-item>
        <el-form-item label="密码" prop="password">
            <el-input v-model="form.password" placeholder="密码" />
        </el-form-item>
        <el-form-item label="">
            <el-button type="primary" @click="onSubmit">登录</el-button>
        </el-form-item>
    </el-form>
</div>
</template>

<style scoped>

</style>
